#include <iostream>
using std::cout;
using std::endl;

int z = 100;
class Point
{
public:
    Point(int x ,int y)
    : _ix(x)
    , _iy(y)
    //引用数据成员的初始化要绑定的内容
    //生命周期不能比引用成员更短
    /* , _ref(_ix) */
    , _ref(z)
    {
        cout << "Point(int,int)" << endl;
    }


    void print(){
        cout << "(" << _ix
            << "," << _iy
            << "," << _ref
            << ")" << endl;
    }

    ~Point(){
        cout << "~Point()" << endl;
    }
private:
    int _ix;
    int _iy;
    
    //c++11允许引用数据成员在声明时初始化
    //但是这种初始化属于默认值属性
    //如果在初始化列表中仍然对这些数据成员进行了初始化
    //那么以初始化列表为准
    int & _ref = _iy;
};

void test0(){
    Point p1(1,9);
    p1.print();
}

int main(void){
    test0();
    return 0;
}
